package com.qupai.controller.auction;

import com.qupai.domain.dto.OrderPageQueryDTO;
import com.qupai.domain.entity.Orders;
import com.qupai.domain.result.PageResult;
import com.qupai.domain.result.Result;
import com.qupai.domain.vo.OrderDetailVO;
import com.qupai.domain.vo.OrdersVO;
import com.qupai.service.IOrderService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/auction/order")
@Tag(name = "订单管理")
public class OrderController {

    @Resource
    private IOrderService orderService;



    @GetMapping("/page")
    @Operation(summary = "条件分页查询")
    public Result<PageResult<OrdersVO>> page(@ParameterObject OrderPageQueryDTO orderPageQueryDTO)
    {

        return Result.success(orderService.page(orderPageQueryDTO));
    }

    @GetMapping("/{id}")
    @Operation(summary = "根据订单id查询详细信息")
    public Result<OrderDetailVO> findById(@PathVariable Long id)
    {
        return Result.success(orderService.findById(id));
    }

    @PutMapping("/status/{status}")
    @Operation(summary = "修改状态")
    public Result status(@PathVariable Integer status, Long id, String cannelReason)
    {
        orderService.status(status, id, cannelReason);
        return Result.success();
    }
}
